import { getAllCompanyApi } from "@/api/managementCenter/departmentPersonnel";
import { reactive } from "vue";
export const searchItemList: Array<SuperSearch.SearchItem> = [
  {
    type: "input",
    label: "账户简称",
    keyName: "shortNameList"
  },

  {
    type: "input",
    label: "户名",
    keyName: "name"
  },
  {
    type: "input",
    label: "账号",
    keyName: "receiveAccount"
  },
  {
    type: "dict-select",
    label: "开户行",
    keyName: "openBankList",
    lookupCode: "DEPOSIT_BANK",
    optConfig: {
      label: "name",
      value: "name"
    },
    attrs: {
      mode: "multiple"
    },
    options: []
  },

  reactive<SuperSearch.SearchItem>({
    type: "select",
    label: "经营单位",
    keyName: "deptIdList",
    optionsRequest: getAllCompanyApi,
    optReqParams: { status: 1, pageNum: 1, pageSize: 9999999, total: 0 },
    optReqCb: (res: Base.GeneraDataType, row: SuperSearch.SearchItem) => {
      const { code, data } = res;
      if (code === 200) {
        row.options = data || [];
      }
    },
    optConfig: {
      label: "name",
      value: "id"
    },
    attrs: {
      mode: "multiple"
    },
    options: []
  }),

  {
    type: "select",
    label: "账号性质",
    keyName: "accountPropertiesList",
    optConfig: {
      label: "name",
      value: "code"
    },
    options: [
      {
        name: "基本户",
        code: "基本户"
      },
      {
        name: "一般户",
        code: "一般户"
      }
    ],
    attrs: {
      mode: "multiple"
    }
  },
  {
    type: "dict-select",
    label: "币种",
    keyName: "currencyList",
    lookupCode: "CURRENCY",
    optConfig: {
      label: "name",
      value: "name"
    },
    attrs: {
      mode: "multiple"
    },
    options: []
  },
  {
    type: "dict-select",
    label: "收款方式",
    keyName: "paymentMethodList",
    lookupCode: "PAYMENT_TERM",
    optConfig: {
      label: "name",
      value: "name"
    },
    attrs: {
      mode: "multiple"
    }
  }
];

// 列表
export const tableColumn: Array<SuperTable.TableCoulmnItem | SuperTable.NestTableColumnItem> = [
  {
    type: "checkbox",
    field: "checkbox",
    minWidth: "50"
  },
  {
    field: "deptName",
    title: "经营单位",
    minWidth: "100"
  },
  {
    field: "shortName",
    title: "账户简称",
    minWidth: "100"
  },
  {
    field: "receiveAccount",
    title: "账号",
    minWidth: "100"
  },
  {
    field: "name",
    title: "户名",
    minWidth: "170"
  },
  {
    field: "openBank",
    title: "开户行",
    minWidth: "100"
  },
  {
    field: "currency",
    title: "币种",
    minWidth: "100"
  },
  {
    field: "exchangeRate",
    title: "汇率",
    minWidth: "100"
  },
  {
    field: "accountProperties",
    title: "账户性质",
    minWidth: "100"
  },
  {
    field: "paymentMethod",
    title: "收款方式",
    minWidth: "100"
  },
  {
    field: "status",
    title: "账户状态",
    minWidth: "100",
    renderSlot: "status"
  },
  {
    field: "remark",
    title: "备注",
    minWidth: "100"
  },
  {
    field: "action",
    title: "操作",
    minWidth: "180",
    renderSlot: "action"
  }
];
